package com.situ.mall.admin.controller;

import com.situ.mall.admin.service.IStatisticsService;
import com.situ.mall.base.vo.CountVO;
import com.situ.mall.base.util.URLUtil;
import com.situ.mall.base.vo.ResVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * ClassName: StatisticsController
 * Package: com.situ.mall.admin.controller
 * Description:
 *
 * @Author Darling_达
 * @Create 2023-03-24 16:04
 * @Version 1.0
 */

@Controller
@RequestMapping(URLUtil.STATISTICS)
public class StatisticsController {

    @Autowired
    private IStatisticsService iStatisticsService;

    @GetMapping(URLUtil.PAGE)
    public String page() {
        return URLUtil.STATISTICS_HTML;
    }

    /**
     * 会员统计
     * @return echarts
     */
    // 按年统计
    @GetMapping(URLUtil.YEAR)
    @ResponseBody
    public List<CountVO> statisticMemberByYear(){
        return iStatisticsService.statisticMemberByYear();
    }

    // 按月统计
    @GetMapping(URLUtil.MONTH)
    @ResponseBody
    public List<CountVO> statisticMemberByMonth(){
        return iStatisticsService.statisticMemberByMonth();
    }


}
